//
//  SearchMusicTableViewCell.m
//  FNer
//
//  Created by 王展 on 15/10/24.
//  Copyright (c) 2015年 wangzhan. All rights reserved.
//

#import "SearchMusicTableViewCell.h"
#import "UIImageView+WebCache.h"

@implementation SearchMusicTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createMusicCell];
    }
    return self;
}

-(void)createMusicCell
{
    self.musicImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10 * XWIDTH, 10 * XWIDTH, 100 * XHIGHT - 20 * XWIDTH, 100 * XHIGHT - 20 * XWIDTH)];
    self.musicImageView.backgroundColor = [UIColor colorWithRed:240 / 255.0 green:240 / 255.0 blue:240 / 255.0 alpha:1];
    [self.contentView addSubview:self.musicImageView];
    
    
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(100 * XWIDTH, 10 * XWIDTH, 260 * XWIDTH, 20 * XHIGHT)];
    [self.contentView addSubview:self.nameLabel];
    self.nameLabel.font = [UIFont systemFontOfSize:16 * XWIDTH];
    self.nameLabel.textColor = [UIColor grayColor];
    
    
    self.infoLabel = [[UILabel alloc] initWithFrame:CGRectMake(100 * XWIDTH, 40 * XWIDTH, 260 * XWIDTH, 50 * XHIGHT)];
    [self.contentView addSubview:self.infoLabel];
    self.infoLabel.font = [UIFont systemFontOfSize:15 * XWIDTH];
    self.infoLabel.textColor = [UIColor lightGrayColor];
}

-(void)setAmusic:(Music *)amusic
{
    _amusic = amusic;
    self.nameLabel.text = self.amusic.name;
    self.infoLabel.text = self.amusic.info;
    [self.musicImageView sd_setImageWithURL:[NSURL URLWithString:self.amusic.pic]];
}

@end
